﻿
using PPSMS_Model;

namespace PPSMS.CommonForm
{
    public partial class DeviceControl : UserControl
    {
        public event Action OnDataReceived;
        public InverterDevices _inverter;
        /// <summary>
        /// 逆变器ID
        /// </summary>
        public long InverterID { get; set; }
        /// <summary>
        /// 逆变器型号
        /// </summary>
        public string Model
        {
            get => label2.Text;
            set => label2.Text = value;
        }
        /// <summary>
        /// 制造商
        /// </summary>
        public string Manufacturer
        {
            get => label1.Text;
            set => label1.Text = value;
        }

        /// <summary>
        /// 额定功率
        /// </summary>
        public string Rated_AC_Power
        {
            get => label4.Text;
            set => label4.Text = value;
        }
        
        /// <summary>
        /// 峰值电流
        /// </summary>
        public string Module_Peak_Power
        {
            get => label7.Text;
            set => label7.Text = value;
        }
        public DeviceControl()
        {
            InitializeComponent();
        }
        public DeviceControl(InverterDevices inverter)
        {
            InitializeComponent();
            _inverter = inverter;
        }

        private void InverterControl_Load(object sender, EventArgs e)
        {
            InverterID = (long)_inverter.InverterID;
            Model = _inverter.Model;
            Manufacturer = _inverter.Manufacturer;
            Rated_AC_Power = _inverter.RatedPower.ToString();
            Module_Peak_Power = _inverter.Module_Peak_Power.ToString();
        }

    }
}
